package com.xc.service.impl;

import com.xc.dto.ResultDTO;
import com.xc.dto.UserDTO;
import com.xc.entity.NavEntity;
import com.xc.entity.StudentEntity;
import com.xc.mapper.NavMapper;
import com.xc.mapper.StudentMapper;
import com.xc.service.NavService;
import com.xc.service.StudentService;
import com.xc.util.JSONCopy;
import com.xc.util.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NavServiceImpl implements NavService {
    @Autowired
    private NavMapper navMapper;


    @Override
    public ResultDTO add(NavEntity navEntity) {
        return ResultDTO.builder()
                .code(0)
                .count(navMapper.add(navEntity))
                .build();
    }

    @Override
    public ResultDTO update(NavEntity navEntity) {
        return ResultDTO.builder()
                .code(0)
                .count(navMapper.update(navEntity))
                .build();
    }

    @Override
    public ResultDTO delete(NavEntity navEntity) {
        return ResultDTO.builder()
                .code(0)
                .count(navMapper.delete(navEntity))
                .build();
    }

    @Override
    public ResultDTO updateEnable(NavEntity navEntity) {
        return ResultDTO.builder()
                .code(0)
                .count(navMapper.updateEnable(navEntity))
                .build();
    }

    @Override
    public ResultDTO findById(NavEntity navEntity) {
        return ResultDTO.builder()
                .code(0)
                .code(0)
                .data(navMapper.findById(navEntity))
                .build();
    }

    @Override
    public ResultDTO findAll(NavEntity navEntity) {

        return ResultDTO.builder()
                .code(0)
                .code(0)
                .count(navMapper.count(navEntity))
                .data(navMapper.findAll(navEntity))
                .build();
    }

    @Override
    public ResultDTO count(NavEntity navEntity) {
        return ResultDTO.builder()
                .code(0)
                .code(0)
                .count(navMapper.count(navEntity))
                .build();
    }

    @Override
    public ResultDTO findByName(NavEntity navEntity) {
        return null;
    }
}
